package command;

import java.util.Collection;
import java.util.Set;

import server.KVMessage.StatusType;
import util.IKeyValueStorage;

public class CommandListValues implements ICommand {
	private IKeyValueStorage storage;
	
	public CommandListValues(IKeyValueStorage storage) {
		this.storage = storage;
	}
	
	@Override
	public String execute() {
		String valuesList = "";
		Collection values = storage.getValues();
		if(values.size()==0) {
			valuesList = "No values";
		} else {
			for (Object val: values) {
				valuesList += val + ", ";
			}
		}
		return ClientInputHandler.composeClientResponse(StatusType.LIST_VALUES_SUCCESS, valuesList, "");
	}
}
